import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Vida here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Vida extends Puntaje
{
    /**
     * Act - do whatever the Vida wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    
    public void act() 
    {
        // Add your action code here.
        getImage().scale(escala,50);
        iniciaDaño();
    }
    public Vida(){
        this.getImage().scale(150,50);
        escala=150;
        numero=0;
        reduce=false;
     }  

    public void iniciaDaño(){
        if(reduce==true){
        if(numero==100 && escala!=1){
            escala=escala-10;
            this.getImage().scale(escala,50);
           
            if(escala<=10){
                escala=10;  
                this.getImage().scale(escala,50);
            }
            numero=0;
        }
        if(escala==10){
           
             World aux=getWorld();
             ((StickmanWorld)aux).StickmanMuere();
        }else{ numero++;}
        }

    }
    public void reduceVida(int FalsoVerdadero){
    if(FalsoVerdadero==1)
    reduce=true;
    if(FalsoVerdadero==0)
    reduce=false;
    }

   public void aumenta(){     
      if(escala<=140){escala=escala+10;}
    }
    
    public void marcaDaño(){
    if(escala!=10)
    escala=escala-10;
    else{
     World aux=getWorld();
          ((StickmanWorld)aux).StickmanMuere();
    
    }
    }
}
